﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UIFW;
using UnityEngine.UI;
using System;

public class PrepareUIForm : BaseUIForm {

    // Use this for initialization
    public void Awake()
    {
        CurrentUIType.uiShowMode = UIShowMode.HideOther;

        //Text text;
        //text = Helper.findChildNodeObj(gameObject, "UserName").GetComponent<Text>();
        //text.text = DemoProject.StartGame.dataLoad.playerInfo.name;

        rigisterButtonEvent("BtnPrepare",
            p =>
            {
             
            }
            );
    }

    private void OnEnable()
    {
        GameObject.Find("PrepareA").GetComponent<Text>().text = "准备";
        GameObject.Find("PrepareB").GetComponent<Text>().text = "未准备";
    }

    public void SetBattleInfo(string inputName, string campType, string isReady)
    {
        if (inputName == DemoProject.StartGame.dataLoad.playerInfo.name)
        {
            Text text = Helper.findChildNodeObj(gameObject, "tPLayerA").GetComponent<Text>();
            text.text = inputName;
        }
        else {
            try
            {
                Text text = Helper.findChildNodeObj(gameObject, "tPLayerB").GetComponent<Text>();
                text.text = inputName;
            }
            catch (Exception e)
            { }
        }
        //TODO:ICON加载
        //TODO:其他信息加载

    }

}
